/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package huynhquocdung;
import Entity.Customers;
import Bean.*;
//import java.util.Collections;
import javax.naming.InitialContext;
/**
 *
 * @author Familly
 */

public class Demo {
    private String CusID;
    private String FisrtName;
    private String LastName;
    private String Password;
    private String Email;
    private String Address;
    private String Phone;
    private String BankName;

    public Demo()
    {

    }
    public Demo(String CusID,String FisrtName,String LastName,String Password,String Email,String Address,String Phone,String BankName)
    {
        this.CusID=CusID;
        this.FisrtName=FisrtName;
        this.LastName=LastName;
        this.Password=Password;
        this.Email=Email;
        this.Address=Address;
        this.Phone=Phone;
        this.BankName=BankName;
    }

    public String getAddress() {
        return Address;
    }

    public void setAddress(String Address) {
        this.Address = Address;
    }

    public String getBankName() {
        return BankName;
    }

    public void setBankName(String BankName) {
        this.BankName = BankName;
    }

    public String getCusID() {
        return CusID;
    }

    public void setCusID(String CusID) {
        this.CusID = CusID;
    }

    public String getEmail() {
        return Email;
    }

    public void setEmail(String Email) {
        this.Email = Email;
    }

    public String getFisrtName() {
        return FisrtName;
    }

    public void setFisrtName(String FisrtName) {
        this.FisrtName = FisrtName;
    }

    public String getLastName() {
        return LastName;
    }

    public void setLastName(String LastName) {
        this.LastName = LastName;
    }

    public String getPassword() {
        return Password;
    }

    public void setPassword(String Password) {
        this.Password = Password;
    }

    public String getPhone() {
        return Phone;
    }

    public void setPhone(String Phone) {
        this.Phone = Phone;
    }
    public String Add()
    {
        CustomersFacadeRemote dao=getCustomerFacadeRemote();
       Customers cus=new Customers();
        cus.setCusID(CusID);
        cus.setFisrtName(FisrtName);
        cus.setLastName(LastName);
        cus.setPassword(Password);
        cus.setEmail(Email);
        cus.setAddress(Address);
        cus.setPhone(Phone);
        cus.setBankName(BankName);
        dao.create(cus);
        return "success";
    }
private CustomersFacadeRemote getCustomerFacadeRemote(){
    CustomersFacadeRemote dao=null;
    try
    {
        System.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
        System.setProperty("java.naming.provider.url","localhost:1099");
        System.setProperty("java.naming.factory.url.pkgs","org.jboss.naming");
        InitialContext ctx=new InitialContext();
        dao=(CustomersFacadeRemote)ctx.lookup("CustomersFacade/remote");
    }
    catch(Exception e)
    {
        e.printStackTrace();
    }
    return dao;
}
}
